home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 4 / The Arsenal Files 4 (Arsenal Computer).ISO / casm / au116-as.exe / UTIL / PERCENT.CPP < prev    next >
C/C++ Source or Header  |  1993-12-05  |  565b  |  24 lines

  1. #include "..\au.hpp"
  2. /**********************************************************************/
  3. char *percent_string(long uncomp, long comp)
  4. {
  5.     static char string[10];
  6.  
  7.     if (uncomp == comp)
  8.         return "   0.0";
  9.     if (uncomp == 0)
  10.         return "   ---";
  11.     if (comp/uncomp > 9)
  12.         return "  -Big";
  13.     if (uncomp>1000000l)
  14.         ltoa(1000l-(comp/(uncomp/1000l)), string, 10);
  15.     else if (uncomp!=0)
  16.         ltoa(1000l-(comp*1000l/uncomp), string ,10);
  17.  
  18.     strcpy(string, left_pad(string, 5));
  19.     string[6] = '\0';
  20.     string[5] = string[4];
  21.     string[4] = '.';
  22.     return string;
  23. }
  24.